function postData() {
    //get the form
    const handleSubmit = (event) => {
        event.preventDefault();

        // Get the form input values 
        const floating = document.getElementById('floatingInput').value;
        const password = document.getElementById('passwordInput').value;

        // Create an object with the new hike data 
        const newHike = {
            floating: floating,
            password: password
        };

        // Check if the hikes object exists in local storage 
        let hikes = localStorage.getItem('hikes');
        if (!hikes) {
            // Create a new hikes object if it doesn't exist 
            hikes = {
                "hikes": []
            };
        } else {
            hikes = JSON.parse(hikes);
        }

        // Add the new hike to the hikes object 
        hikes.hikes.push(newHike);

        // Save the updated hikes object to local storage 
        localStorage.setItem('hikes', JSON.stringify(hikes));

        // Redirect to main.html 
        

    };

    // Add event listener to the form submit event 
    const form = document.getElementById('newHikeForm');
    form.addEventListener('submit', handleSubmit);
}
postData();